import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

class NewRouteStackPosition extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("New route"),
      ),
      body: Center(
        child: SizedBox(
          height: 100,
          width: 100,
          child: ConstrainedBox(
            constraints: BoxConstraints.expand(),
            child: Stack(
              alignment: Alignment.center, //指定未定位或部分定位widget的对齐方式
              fit: StackFit.expand, //未定位widget占满Stack整个空间
              overflow: Overflow.visible, // 超出显示
              children: <Widget>[
                Positioned(
                  left: 18.0,
                  child: Text("I am Jack"),
                ),
                Container(
                  child: Text("Hello world", style: TextStyle(color: Colors.white)),
                  color: Colors.red,
                ),
                Positioned(
                  top: -18.0,
                  child: Text("Your friend"),
                )
              ],
            ),
          ),
        ),
      ),
    );
  }
}
